﻿using System;
using System.Diagnostics;
using System.Linq;

namespace Problem006
{
    // Brute force solution
    class Program
    {
        private const int maxNumber = 100;

        static void Main()
        {
            var stopwatch = new Stopwatch();
            stopwatch.Start();

            long sumOfSquares = 0;
            long squareOfSums = 0;

            foreach (var number in Enumerable.Range(1, maxNumber))
            {
                squareOfSums += number;
                sumOfSquares += (long) Math.Pow(number, 2);
            }

            squareOfSums = (long) Math.Pow(squareOfSums, 2);
            stopwatch.Stop();

            Console.WriteLine(squareOfSums - sumOfSquares);
            Console.WriteLine("Execution time: {0}ms", stopwatch.ElapsedMilliseconds);

            Console.ReadKey();
        }
    }
}
